/*
 * @Author: zhangwei 1405298045@qq.com
 * @Date: 2022-02-24 17:10:35
 * @LastEditTime: 2022-03-10 16:57:42
 * @LastEditors: zhangwei 1405298045@qq.com
 * @Description:
 * @FilePath: /ll-fe-mp-dyfx/src/store/index.js
 *
 */
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const modulesFiles = require.context('./modules', true, /\.js$/);

const modules = modulesFiles.keys().reduce((modules, modulePath) => {
	const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');

	const { default: formatValue } = modulesFiles(modulePath);

	modules[moduleName] = formatValue;

	return modules;
}, {});

const Store = new Vuex.Store({
	modules
});

export default Store;
